﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;

/// <summary>
/// Summary description for Utilities
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class Utilities : System.Web.Services.WebService {

    public Utilities () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    [ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
    public string ResolveUrl(string url)
    {
        string resolvedUrl = ECommerce.Library.ImageResizer.CheckImageMissing(url, AutoGear.BLL.SiteSettings.NoImageUrl);
        if (!resolvedUrl.Contains("http://"))
            resolvedUrl = SiteGlobals.BaseUrl + resolvedUrl.Replace("~/", "");
        return resolvedUrl;
    }
}
